"""
    员工添加页面类
"""
from time import sleep

from selenium.webdriver.common.by import By

from base.base_page import BasePage


class PageEmpAdd(BasePage):
    # 初始化
    def __init__(self):
        super().__init__()
        self.system_manager_link = (By.XPATH,"//span[contains(text(),'系统信息管理')]")
        self.emp_manager_link = (By.XPATH,"//span[contains(text(),'员工管理')]")
        self.emp_add_btn  = (By.XPATH,"//span[contains(text(),'+ 新增员工')]")
        self.username_add  = (By.XPATH,"//*[@id='app']/div/div[2]/section/div/div[2]/div/div[2]/form/div[1]/div/div/input")
        self.name_add = (By.XPATH,"//*[@id='app']/div/div[2]/section/div/div[2]/div/div[2]/form/div[2]/div/div/input")
        self.cancel_btn = (By.XPATH,"//span[contains(text(),'取消')]")
    def page_emp_add(self):
        # 点击系统管理
        self.base_click(self.system_manager_link)
        sleep(1)
        # 点击员工管理
        self.base_click(self.emp_manager_link)
        # 点击新增员工按钮
        self.base_click(self.emp_add_btn)
        # 输入用户名
        sleep(0.5)
        self.base_input_text(self.username_add,"fhd")
        # 输入员工姓名
        sleep(0.5)
        self.base_input_text(self.name_add,"风化解")
        # 点击取消按钮
        self.base_click(self.cancel_btn)




